<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
     <div id="app">
        <!-- 相当于 a 标签 -->
        <router-link to="/pic">图片</router-link>
        <!-- 路由内容需要有一个出口 router-view-->
        <router-view></router-view>
     </div>
    <script src="./vue.js"></script>
    <script src="./vue-router.js"></script>
    <script>
        /* 创建路由的规则 */
        let pic = {
            template:`<h1>图片</h1>`
        }
        /* 变量名，故意写成 routes,配置项叫 routes */
        let routes = [
            {
                path:"/pic",
                component:pic
            }
        ]
        // 创建一个 路由的实例
        // 注意 命名，router 
        let router = new VueRouter({
            routes, // routes:routes
            // mode:"history"
        })
        let vm = new Vue({
            router,// router:router
            el:"#app",
            data:{

            }
        })
    </script>
</body>
</html>